package cond

import (
	"clientDemo/service/cond"
	"clientDemo/service/event"
	"clientDemo/service/growth"
	"clientDemo/service/mission"
)

func init() {
	_ = event.RegeditEvent(growth.EventType_Growth_Level_Update, growthLevelUpdate())
	_ = event.RegeditEvent(mission.EventType_Mission_Update, missionUpdate())

}

func missionUpdate() func(eventId int, param *event.EventParams) {
	return func(eventId int, param *event.EventParams) {

	}
}

func growthLevelUpdate() func(eventId int, param *event.EventParams) {
	return func(eventId int, param *event.EventParams) {
		if param == nil {
			return
		}
		if len(param.Param) < 3 {
			return
		}

		var roleId uint32 = param.Param[0].(uint32)
		var growthId uint32 = param.Param[1].(uint32)
		var level uint64 = param.Param[2].(uint64)

		_m.DispatchDataSource(roleId,
			cond.Value_Category_Growth,
			[]interface{}{uint32(growthId), uint32(cond.Cond_ValueParamType_Growth_Level)},
			uint64(level))
	}
}
